package com.lg.concurrent.atomic;

import java.util.concurrent.atomic.DoubleAdder;

/**
 * 累加器
 */
public class DoubleAdderTest {
    public static void main(String[] args) {
        DoubleAdder doubleAdder = new DoubleAdder();
        doubleAdder.add(2);
        doubleAdder.add(3);
        System.out.println(doubleAdder.toString());
        doubleAdder.reset();
        System.out.println(doubleAdder.intValue());
        doubleAdder.add(9);
        doubleAdder.add(-7);
        System.out.println( doubleAdder.sum());
        System.out.println(doubleAdder.doubleValue());

    }
}
